import axios from 'axios';
import nprogress from 'nprogress';
import 'nprogress/nprogress.css'
const ajax=axios.create({
    baseURL:'/api',
    timeout:2000
})
ajax.interceptors.request.use((config)=>{
    nprogress.start()
    return config
})
ajax.interceptors.response.use(
    response=>{
        nprogress.done()
        return response.data
    },
    error=>{
        nprogress.done()
        alert(error)
        return new promise(()=>{})
    }

)
export default ajax